<?php
/*
 * df.php - Data Formatter.
 */

require ($SCRIPT_DIR . '/inc/formatter.inc.php5');


/*
 * Variabili.
 */

/*
 * Esecuzione.
 */

$fmt = createFormatter() or die;
$fmt->readXML() or die;
$fmt->transform();

/*
 * Funzioni.
 */

function createFormatter ()
{
	global $PATH;
	global $DF_URI;
	if ($PATH == "{$DF_URI}/xhtml/format/fragment")
		return new XHTMLFragmentFormatter ();
	if ($PATH == "{$DF_URI}/xhtml/format/document")
		return new XHTMLDocumentFormatter ();
	if ($PATH == "{$DF_URI}/pdf/format/document")
		return new PDFDocumentFormatter ();
	if ($PATH == "{$DF_URI}/text/format/document")
		return new ASCIIDocumentFormatter ();

	echo DFError ("404", "Formatter richiesto inesistente.");
	return false;
}

?>
